﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%
	String filePath = request.getParameter("filePath");
	if(filePath==null){
		filePath="";
	}
 %> 

<html>
<head>
	<!--<meta http-equiv="Content-Type" content="text/html; charset=gb2312">-->
	<meta http-equiv="X-UA-Compatible" content="IE=10"/>
	<jsp:include page="../../import.jsp" flush="true" />
	<title>SDK 演示</title>
	<script type="text/javascript" src="<%=path %>/resource/lib/plugins/ajaxfileupload.js"></script>
	<script src="<%=path %>/resource/lib/axcam/WsUtil.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=path %>/resource/lib/axcam/OcxUtil.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=path %>/resource/lib/axcam/axCam_Ocx.js" type="text/javascript" charset="utf-8" for="axCam_Ocx" event="MessageCallback(type,str)"></script>
	<script  type="text/javascript" >
			var ipadr='<%= request.getRemoteAddr() %>';
   var  jpgpdf=null;
    var isIE = true;        //是否IE
    var isSecondDev = false; //是否有两个canvas显示视频
    var camidMain = 0;    //主头ID
  //  var camidSub = 0;     //副头ID
    var rebackfile=null;  //图片删除


  //页面关闭时,停止摄像头,停止身份证读卡
  window.onbeforeunload = function(event) { 
  	StopICWork();
  	CloseCam(); 
  } 

//加载控件
function loadActiveX() {
	if (navigator.userAgent.indexOf('MSIE') >= 0) {
		isIE = true;
         //IE浏览器加载控件
         document.getElementById("ActiveXDivOne").innerHTML = "<OBJECT id=\"axCam_Ocx\"  classid=\"clsid:D5BD5B4A-4FC0-4869-880B-27EE9869D706\" width=\"500px\" height=\"400px\" ></OBJECT>";
    //     document.getElementById("ActiveXDivTwo").innerHTML = "<OBJECT id=\"axCam_Ocx2\"  classid=\"clsid:341014BA-CD4A-4918-A11F-8A33B152915A\" width=\"500px\" height=\"400px\" ></OBJECT>";
         OcxInit();
     }
     else {
     	isIE = false;
     	if (!window.WebSocket) { 
     		alert("WebSocket not supported by this browser!"); 
     	} 
        //其他浏览器加载控件
        document.getElementById("ActiveXDivOne").innerHTML =" <canvas id=\"cameraCanvas\" width=\"500px\" height=\"400px\" style=\"border:1px solid #d3d3d3;\">";
     //   document.getElementById("ActiveXDivTwo").innerHTML =" <canvas id=\"cameraCanvasSecond\" width=\"500px\" height=\"400px\" style=\"border:1px solid #d3d3d3;\">";
        WsInit(500,400,500,400,true,ipadr);     
    }
     
}

 //必需重写---获取设备名称(num为当前摄像头数量,strUsbNamr为摄像头名字数组)
 function GetDevName(num,strUsbNamr){
 	var obj = document.getElementById("DeviceName");
 	obj.options.length = 0;
 	for(var i=0;i<num;i++){
 		var objOption = document.createElement("option");
 		objOption.text = strUsbNamr[i];
 		objOption.value = i;
 		obj.options.add(objOption);
 	}
 	

 }

//必需重写---获取分辨率(data为分辨率数组,每2个为一组,宽高)
function GetDeviceResolution(data) {
	var obj = document.getElementById("Resolution");
	var max = 0;
	var maxIndex = 0;
	obj.options.length = 0;
	if(data.length>0){
		for(var i=0;i<data.length/2;i++){
			var objOption = document.createElement("option");
			var ww = data[i*2];
			var hh = data[i*2+1];
			objOption.text = ""+ww+"*"+hh;
			objOption.value = i;
			obj.options.add(objOption);
			if(max<ww){
				max = ww;
				maxIndex = i;
			}
		}
		obj.options[maxIndex].selected = true;
	}
} 

 
//必需重写---获取设备数量
function GetDevCount(camNum){
	alert("摄像头数量:"+camNum); 
}

//设备1初始化完成,可以进行相关操作
function LoadOver(){
  StartVideo();
    //设定文件命名
  funSetFileNameModel();
  //设置拍照存储路径
  SetFilePath();
  
}

//设备2初始化完成,可以进行相关操作
function LoadOver2(){
  StartVideo2();
}


//开启摄像头
function StartVideo() 
{
	var obj = document.getElementById("Resolution");
	var restr = obj[obj.selectedIndex].text;
	var pos = restr.lastIndexOf("*");
	var width = parseInt(restr.substring(0, pos));
	var height =parseInt(restr.substring(pos + 1, restr.length));
	StartCam(camidMain,width,height);

}

//关闭摄像头
function CloseVideo() 
{
	CloseCam(); 
}

//抓图拍照
function Capture() {
	var type = 0;
  CaptureImage(type);
  
}


//切换分辨率
function ChangeResolution() {
	CloseCam();
	var obj = document.getElementById("Resolution");
	var restr = obj[obj.selectedIndex].text;
	var pos = restr.lastIndexOf("*");
	var width = parseInt(restr.substring(0, pos));
	var height = parseInt(restr.substring(pos + 1, restr.length));
	StartCam(camidMain,width,height);

}

//设置图片类型
function SetFileType() 
{
	var type = document.getElementById("FileType").selectedIndex;
	SetImageType(type);
}
//转换为PDF
function funConvertToPDF(){
	var pdfpath = jpgpdf.replace('.jpg','')+".pdf";
	AddPDFImageFile(jpgpdf);
	SavePDF(pdfpath);
}


//设置图片颜色格式
function SetImageColorMode() 
{
	var type = document.getElementById("ColourMode").selectedIndex;
	SetColorMode(type);
}

//图像设置窗口
function ShowImageSettingWindow()
{
	ShowSettingWindow();
}

//设置是否裁剪
function SetCutType() {
	var type = 1;

	if (document.getElementById("Radio1").checked) {
		type = 0;
	}
	if (document.getElementById("Radio2").checked) {
		type = 1;
	}
	//if (document.getElementById("Radio3").checked) {
	//	type = 2;
//	}
	SetCamCutType(type);
}



//设置保存的文件路径
function SetFilePath(){
	var path = "D:\\"
	SetImagePath(path);
	SetImagePath2(path);
}

//设置拍照时是否只返回base64
function funSetImagebase64(){
	var isCheck = document.getElementById("checkboxBase").checked;
	if(isCheck){
		SetImagebase64(1);
	}else {
		SetImagebase64(0);
	}

}
//上传图片
function funUpdataFile(){
	alert(1);
	UpdataFile("localhost", 8080, "/system/sysulfilesrec/upload.do","D:\\IMGAAA001.jpg");
}

//刷新设备
function RefreshDev(){
	CloseCam(); 
	CloseCam2();
	RefreshDevice();
}



//设置水印
function SetWaterType(){
	if (document.getElementById("Radio6").checked) {
		CloseWaterMark();
	}
	if (document.getElementById("Radio7").checked) {
		var waterinfo = "狮桥资本";
		var FontSize = 50;
		var FontSytle = 0;
		var xOff = 100;
		var yOff = 100;
		OpenWaterMark(waterinfo, FontSize, FontSytle, 255, 0, 0, xOff, xOff);
	}
}

//设置自动裁边单图与多图
function funsetJiubianModel(){
	if (document.getElementById("Radio13").checked) {
		SetJiubianModel(0);
       // axCam_Ocx.CusCrop(0);
   }else if (document.getElementById("Radio14").checked) {
   	SetJiubianModel(1);
   }
}

//设置四周补白
function funsetBuBai(){
	var isCheck = document.getElementById("checkbox2").checked;
	if(isCheck){
		SetBuBai(1);
	}else  SetBuBai(0);
}

//设置去灰
function funsetQudise(){
	var isCheck = document.getElementById("checkbox1").checked;
	if(isCheck){
		SetQudise(1);    
	}else SetQudise(0);
}
//设定拍照文件名
function funSetFileNameModel(){
   var num = 1;
   var numstr;
  var name = "IMGAAA";
  SetFileNameCustom(name,num);
}

function funSetAutoExposure(){
	if (document.getElementById("RadioExopen").checked) {
		SetAutoExposure(1);
   }else if (document.getElementById("RadioExclose").checked) {
   		SetAutoExposure(0);
   }
}

function funGetCamParameter(){
	GetCamParameter();
}

function funSetExposure(){
	SetExposure(0);
}

function funSetBrightness(){
	SetBrightness(0);
}

function funGetCamNum(){
	GetCamNum();
}

function funDeleteFile(){
	var filename = "D:\\1.jpg";
	DeleteFile(filename);
}

var hide_show = 0;
function ShowHide() {

	if (hide_show == 0) {
		hide_show = 1;
		if(isIE){
			document.getElementById("axCam_Ocx").style.visibility = "hidden";
		}else  document.getElementById("cameraCanvas").style.visibility = "hidden";
	}
	else {
		hide_show = 0;
		if(isIE){
			document.getElementById("axCam_Ocx").style.visibility = "visible";
		}else  document.getElementById("cameraCanvas").style.visibility = "visible";
	}

}

function ShowInfo(op) {
	var obj = document.getElementById("TextArea1");
	obj.value = op+obj.value;
}
function InfoCallback(op) {
	var text = "";
	if(op == 0){
		text = "连接成功\r\n";
	}else if(op == 0x01){
		text = "断开成功\r\n";
	}else if(op == 0x02){
		text = "设备已经连接\r\n";
	}else if(op == 0x03){
		text = "设备已经关闭\r\n";
	}else if(op == 0x04){
		text = "拍照成功\r\n";
	}else if(op == 0x05){
		text = "pdf添加文件成功\r\n";
	}else if(op == 0x06){
		text = "pdf保存成功\r\n";
	}else if(op == 0x07){
		text = "图片合并成功\r\n";
	}else if(op == 0x08){
		text = "智能连拍启动\r\n";
	}else if(op == 0x09){
		text = "定时连拍启动\r\n";
	}else if(op == 0x10){
		text = "定时连拍成功\r\n";
	}else if(op == 0x11){
		text = "定时连拍关闭\r\n";
	}else if(op == 0x12){
		text = "文件上传服务器成功\r\n";
	}else if(op == 0x13){
		text = "水印开启\r\n";
	}else if(op == 0x14){
		text = "水印关闭\r\n";
	}else if(op == 0x15){
		text = "此设备属于本公司\r\n";
	}else if(op == 0x16){
		text = "此设备不属于本公司\r\n";
	}else if(op == 0x17){
		text = "自动曝光启动\r\n";
	}else if(op == 0x18){
		text = "自动曝光关闭\r\n";
	}else if(op == 0x19){
		text = "身份证功能启动成功\r\n";
	}else if(op == 0x1a){
		text = "身份证功能启动失败\r\n";
	}else if(op == 0x1b){
		text = "身份证读卡成功\r\n";
	}else if(op == 0x1c){
		text = "身份证读卡失败\r\n";
	}else if(op == 0x1d){
		text = "重新操作\r\n";
	}else if(op == 0x1e){
		text = "未发现模块\r\n";
	}else if(op == 0x1f){
		text = "未启动身份证功能\r\n";
	}else if(op == 0x20){
		text = "启动身份证自动读卡\r\n";
	}else if(op == 0x21){
		text = "关闭身份证自动读卡\r\n";
	}else if(op == 0x22){
		text = "启动拍照只生成base64\r\n";
	}else if(op == 0x23){
		text = "关闭拍照只生成base64\r\n";
	}


	else if(op == 0xa0){
		text = "没有对应分辨率\r\n";     
	}else if(op == 0xa1){
		text = "pdf没有添加任何文件\r\n";     
	}else if(op == 0xa2){
		text = "文件不存在\r\n";     
	}else if(op == 0xa3){
		text = "意外断开\r\n";     
	}else if(op == 0xa4){
		text = "连接不上\r\n";     
	}else if(op == 0xa5){
		text = "pdf添加文件不是jpg格式\r\n";     
	}else if(op == 0xa6){
		text = "没有发现摄像头\r\n";     
	}else if(op == 0xa7){
		text = "camid无效\r\n";     
	}else if(op == 0xa8){
		text = "图片尺寸太小\r\n";     
	}else if(op == 0xa9){
		text = "文件上传服务器失败\r\n";     
	}else if(op == 0xaa){
		text = "该设备没有副头\r\n";     
	}else if(op == 0xab){
		text = "条码识别失败\r\n";     
	}else if(op == 0xac){
		text = "二维码识别失败\r\n";     
	}else if(op == 0xad){
		text = "图片合并失败\r\n";     
	}else if(op == 0xae){
		text = "设置路径文件不存在\r\n";     
	}

	var obj = document.getElementById("TextArea1");
	obj.value = text+ obj.value;
}
var photonum=0;
var photo=[];
function InfoTextCallback(type,str){

	var text = "";
	jpgpdf=str;
	if(type == 0){
		text = "图片路径:"+str+"\r\n";
		//jpg转pdf
		//funConvertToPDF();
		createBase64FromFile(str);
	}else if(type == 1){
		text = "默认路径:    "+str+"\r\n";

	}else if(type == 2){
		text = "条码:    "+str+"\r\n";

	}else if(type == 3){
		text = "文件上传服务器成功:"+str+"\r\n";

	}else if(type == 4){
		text = "文件上传服务器失败:"+str+"\r\n";

	}else if(type == 5){
		//text = "base64编码成功,请自行处理str\r\n";
		//photo[photonum]="data:;base64," +str;
		photo[photonum]="" +str;
		photonum=photonum+1;
		//var imgobj1 = document.getElementById("img1");
		// 	imgobj1.src = "data:;base64," + str;
		
}else if(type == 6){
	text = "删除文件成功:"+str+"\r\n";
}else if(type == 7){
	text = "二维码:"+str+"\r\n";
}else if(type == 8){
	text = "拍照失败:"+str+"\r\n";
}

else if(type == 9){
	text = "身份证名字:"+str+"\r\n";
}else if(type == 10){
	text = "身份证号码:"+str+"\r\n";
}else if(type == 11){
	text = "身份证性别:"+str+"\r\n";
}else if(type == 12){
	text = "身份证民族:"+str+"\r\n";
}else if(type == 13){
	text = "身份证生日:"+str+"\r\n";
}else if(type == 14){
	text = "身份证地址:"+str+"\r\n";
}else if(type == 15){
	text = "身份证签发机关:"+str+"\r\n";
}else if(type == 16){
	text = "身份证有效开始日期:"+str+"\r\n";
}else if(type == 17){
	text = "身份证有效截至日期:"+str+"\r\n";
}else if(type == 18){
	text = "安全模块号:"+str+"\r\n";
}else if(type == 19){
 	//身份证头像
 	var imgobj1 = document.getElementById("img1");
 	imgobj1.src = "data:;base64," + str;
 }else if(type == 21){
 	//text = "base64编码成功,请自行处理str(副头)\r\n";
 //text ="data:;base64," +str+"\r\n";
 var imgobj1 = document.getElementById("img2");
 	imgobj1.src = "data:;base64," + str;
}else if(type == 22){
	text = "曝光范围:"+str+"\r\n";
}else if(type == 23){
	text = "亮度范围:"+str+"\r\n";
}

var obj = document.getElementById("TextArea1");
obj.value = text+ obj.value;
}
//创建64编码及显示
function createBase64FromFile(path){
	var idname="photoUp"+photonum;
	var fileName=path.substring(path.lastIndexOf("\\")+1);
	$("#photoUp").append('<span class="photoUp" fileName="'+fileName+'" id="'+idname+'">'+path
			+'<input type="button" onclick = "delFile(\''+idname+'\');" value="删除"></span><br>');
	GetBase64FromFile(path);
	
}
//删除64编码及显示
function delFile(obj){
	$("#"+obj).attr("hide","1");
	$("#"+obj).hide();
}
</script>

</head>

<body onload ="loadActiveX();initip();">
	<div style="width:500px; height: 550px; border: 1px solid white; background:#C7EDCC;  float:left">

		<div  width="100%" height="400px" id='ActiveXDivOne'>
		</div>
		<p align="center" style=" width:100%; height:30px">                  
			<table style="width:100%;">
				<tr>
				 					<td class="style1">
						<select id="DeviceName" name="D1"onchange = "ChangeDevice()"  style='display:none'>
						</select></td>
					</tr>
					<tr>
						<td class="style3">
							<select id="Resolution" name="D2"onchange = "ChangeResolution()" style='display:none'>
							</select></td>
						</tr>
					</table>
					<table>
						<tr>
							<td>
							<input id="Button2" class="sq-button sq-button-hasicon" type="button" value="拍照" onclick = "Capture();"/>
							</td>
						</tr>

					</table>
					</p>	
					
					
					
			</div>
	<!--
			<div style="width:500px; height: 550px; border: 1px solid white; background:#C7EDCC;  float:left">

				<div  width="100%" height="400px" id='ActiveXDivTwo' display="true">
				</div>

					</div>
    -->
		<div style="width:250px; height: 100%; background:#C7EDCC; border: 1px solid black;float:left">
						<!-- div style="width: 100%;height: 30%;">

							<img id="img1"  style="width: 99%;height: 100%" />

						</div--> 
						<div style="width: 100%;height: 40%;">
								<textarea id="TextArea1" cols="20" rows="2" style="width: 100%;height:100%;">
								</textarea> 
							</div>
						<!-- 拍照完成的文件 -->
						<div style="width: 100%;" id="photoUp">
						</div>	
						<!-- 上传控件 -->
						<div style="width: 100%;">
						<br>
						<span class="sq-button-hasicon onlyicon" id="add_upfileBox2"><i class="sqBtnIco_26"></i></span>
						<div class="upfileBoxs"></div>
						<input type="hidden" id="filePath" value="arcfile"/>
						</div>
			</div>
					
 	
<script type="text/javascript">
  
      var count = 1;
      var upload_result_params = []; 
   	  var serverPrefixPath = "";
      
      $(function(){
    	  $("#add_upfileBox2").click();
    	  
    	  //获取服务器路径前缀
    	  $.ajax({
	    		type: 'get',
	    		url: '<%=path%>/system/sysulfilesrec/getServerPath.do',
	    		success:function(msg){
	    			serverPrefixPath = msg;
	    			console.log(serverPrefixPath);
	    		}
	    	});
      });
      
 //     $("#btnUpload2").click(function() {
 //   	   	ajaxFileUploadImg();
 //     });
      var FileCount=1;
      $("#add_upfileBox2").click(function(event) {
    	  if(FileCount>10){
    		  $.ligerDialog.SQalert({content: "超出最大上传数量" , SQ_type: "warning" });
    		  return;
    	  }
    	  //var path="d:\\BugReport.txt";
    	  //var file=path.substring(path.lastIndexOf("\\")+1);
    	  //alert(file);
          $Html=CreatUploadInputBox({
              id:"uploads"+FileCount,  //id不跟着序号走！
              clearLine: true,
              deletable: true,
              //placeholder: file,
              onDelete: function  (upfileBox) {
            	  FileCount--;
                  setUpfileCount (); //删除的时候重新设置序号
                  var delFileName = upfileBox.find('[type=file]')[0].files[0].name;
                  var temp;
                  for(temp = 0; temp < upload_result_params.length;temp++){
                	  if(upload_result_params[temp].fileNm == delFileName){
                		  upload_result_params.splice(temp,1);
                		  break;
                	  }
                  }
              },
              onChange: function (e) {
                  $(e.target).remove_afterUploadIcon();//删除时,移除已上传文件的下载按钮
              }
          });
          
          $Html.prepend('<span class="UpfileCount"></span>');
          $(".upfileBoxs").append($Html);
          //$Html.insertBefore($(this));
          //$Html.appendTo($("#more"));
          setUpfileCount (); //新增组件后，设置序号
          FileCount++;
      });
      function setUpfileCount () { //设置序号
          $(".UpfileCount").each(function(index, el) {
              $(this).html(index+1);
          });
      	  
      }
     
        //获取上传结果参数
        function getUploadResultParams(){
        	return upload_result_params;
        }
        //清除上传结果参数
        function clearUploadResultParams(){
        	//移除文件上传标签
        	$(".fileUploadBox").remove();
        	upload_result_params = [];//设置参数为空
        	FileCount = 1;
        	$("#add_upfileBox2").click();
        }
        
        //上传回调方法
        function uploadCallbackForMore(_data){

        }
    
</script>	
	<script type="text/javascript">
	//返回给调用窗口,返回结果为Map集合
	frameElement.dialog.onOk = function(){
		
		saveUpload('${id}');
	}
	
	frameElement.dialog.onCancel = function (){
		
		frameElement.dialog.close();
	}
	
		//上传保存
		function saveUpload(id){
			var wait_dialog=$.ligerDialog.SQalert({content: '上传中,请稍后...' ,SQ_type: "waitting" });
			
			var n=0;
			
			var i=0;
			if(photonum<1){
				//上传手动添加的
				uploadComm(id);
				return;
			}
			var _filePath = $("#filePath").val();
			//先把文件一个一个传上去
			var array=[];
			var nameArray=[];
			var data = {
					"id": id,
					"filePath":_filePath
				};
			$(".photoUp").each(function(){
				if($(this).attr("hide")!='1'){
					nameArray[i]=$(this).attr("fileName");
					array[i]=photo[n];
					i=i+1;
				}
				n++;
			});
			//然后把文件路径信息保存到数据库
			var docArray = JSON.stringify(array);
			var name = JSON.stringify(nameArray);
    		var data = {
					"id": id,
					"filePath":_filePath,
					"datas":docArray,
					"fileNames":name
				};
    		var param = "{fileNames:'"+name+"',datas:'"+docArray+"'}";
    		$.ajax({
				type: 'post',
				dataType: 'json',
				contentType:"application/json;charset=utf-8",
				data:param,
				url: '<%=path%>/archive/arcApplyMain/saveUploadPhoto.do?flag=${flag}&id='+id+'&filePath='+_filePath,
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},success:function(msg){
					//wait_dialog.close();
					if(msg.success == 1){
						//上传手动添加的
						if(msg.id!=''){
							setfiles(id,msg.id);
							uploadComm(id);
						}else{
							$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
						}
						//parent.$("#"+id).html('<a   href="<%=path%>/warrant/warrantfilemanage/zipDownloadByPkId.do?pkId='+msg.id+'" >下载</a>');
						//frameElement.dialog.close();
						//$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
					}else{
						$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				},error:function (XMLHttpRequest, textStatus, errorThrown) { 
					//wait_dialog.close();
					$.ligerDialog.SQalert({content: "网络错误，请稍后重试",SQ_type: "error"});
				} 
			});
           
		}	
		function uploadComm(id){
			 //获取file的全部id  浏览上传
            var uplist = $("input[id^=uploads]"); 
            //alert(JSON.stringify(uplist));
            if(uplist.length==0){
            	//$.ligerDialog.SQalert({content: "没有要上传的内容！" , SQ_type: "warning" });
				$.ligerDialog.SQalert({content: "成功",SQ_type: "success"});
				frameElement.dialog.close();
            	return;
            }
	        var arrId = [];
	        var fileNames = [];//用于判断是否有重名文件
	        for (var i=0; i< uplist.length; i++){  
	            if(uplist[i].value){  
	                arrId[i] = uplist[i].id; 
	                if($.inArray(uplist[i].value, fileNames) >= 0){
	                	$.ligerDialog.SQalert({content: uplist[i].value+"文件重名！" , SQ_type: "warning" });
	                	return;
	                }
	                fileNames[i] = uplist[i].value;
	            }  
            }
	        if(arrId.length==0){
            	//$.ligerDialog.SQalert({content: "没有要上传的内容！" , SQ_type: "warning" });
            	$.ligerDialog.SQalert({content: "成功",SQ_type: "success"});
				frameElement.dialog.close();
            	return;
            }
	        var _filePath = $("#filePath").val();
       		
			//var wait_dialog = null;
			//var docArray = JSON.stringify(getUploadResultParams());
			
			$.ajaxFileUpload({  
	            url:'<%=path%>/system/sysulfilesrec/upload.do',
	            secureuri:false,  
	            fileElementId: arrId,  //这里不在是以前的id了，要写成数组的形式！  
	            dataType: 'json',  
	            data: {filePath:_filePath},  
	            success: function (msg){
	            	
	            	if(msg.success == 1){
	                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
	                  
	            		upload_result_params=msg.data;
	            		var docArray = JSON.stringify(msg.data);
	            		var data = {
	        					"fileParams":docArray,
	        					"id": id
	        				};
	                    $.ajax({
	        				type: 'post',
	        				dataType: 'json',
	        				data:data,
	        				url: '<%=path%>/archive/arcApplyMain/saveUpload.do?flag=${flag}',
	        				beforeSend: function(){
	        					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
	        				},success:function(msg){
	        					
	        					if(msg.success == 1){
	        						setfiles(id,msg.id);
	        						//parent.$("#"+id).html('<a   href="<%=path%>/warrant/warrantfilemanage/zipDownloadByPkId.do?pkId='+msg.id+'" >下载</a>');
	        						$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
	        						frameElement.dialog.close();
	        						
	        					}else{
	        						$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	        					}
	        				},error:function (XMLHttpRequest, textStatus, errorThrown) { 
	        					//wait_dialog.close();
	        					$.ligerDialog.SQalert({content: "网络错误，请稍后重试",SQ_type: "error"});
	        				} 
	        			});
	            		
	                } else{
	                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
	                }
	            },
	            complete: function(){
	            	
	            }
	        });  
			
		}
		function setfiles(id,pkId){
			
			var data={pkId:pkId,tabNm:'ARC_MGR_DETAIL'};
			 $.ajax({
					type: 'get',
					dataType:'json',
					data:data,
					async:false,
					url: '<%=path%>/system/sysulfilesrec/initList.do',
					success:function(list){
						if(list!=null&&list!=''){
							var h="";
							for(var i=0;i<list.rows.length;i++){
								
								h+='<a href="javascript:uploadFileByUrl(';
				                h+="'"+list.rows[i].filePath+"'";
				                h+=",'"+list.rows[i].fileNm+"'";
				                h+=')">'+list.rows[i].fileNm+'</a>';
				                
					            //添加删除
				                if(1==1){
				                	h+=' | <a  href="javascript:uploadFileDeleteRow(';
					                h+="'"+list.rows[i].id+"'";
					                h+=",'"+id+"'";
					                h+=",'"+pkId+"'";
					                
					                h+=')"><i class="sqBtnIco_7"></i>删除</a>'  
					            }
				                h+='<br>';
							}
							parent.$("#"+id).html(h);
				            
						}
					}
				});
		}
		</script>
				</body>

									</html>